package io.github.lee.jel.repository

import io.github.lee.jel.api.ApiModule
import io.github.lee.jel.dao.JellyfinSessionDao
import io.github.lee.jel.domain.Folder
import io.github.lee.jel.domain.Item
import io.github.lee.jel.domain.LoginResponse
import io.github.lee.jel.domain.Page
import io.github.lee.jel.domain.Response
import javax.inject.Inject

class UserRepository @Inject constructor(private val dao: JellyfinSessionDao) : BaseRepository() {
    private val api by lazy {
        ApiModule.userApi()
    }
    //===Desc:=============================================================

    suspend fun login(username: String, password: String): Response<LoginResponse> {
        val map = mapOf(
            "Username" to username,
            "Pw" to password
        )
        return api.login(toRequestBody(map))
    }


    suspend fun views(userId: String?): Response<Page<Item>> =
        api.views(userId ?: "")


}